<?php

/**
 * Passport form base class.
 *
 * @package    form
 * @subpackage passport
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 8508 2008-04-17 17:39:15Z fabien $
 */
class BasePassportForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'passport_number' => new sfWidgetFormInput(),
      'place_issued'    => new sfWidgetFormInput(),
      'date_issued'     => new sfWidgetFormDate(),
      'date_valid'      => new sfWidgetFormDate(),
      'date_renewal'    => new sfWidgetFormDate(),
      'renewal'         => new sfWidgetFormInputCheckbox(),
      'person_id'       => new sfWidgetFormDoctrineChoice(array('model' => 'Person', 'add_empty' => false)),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => 'Passport', 'column' => 'id', 'required' => false)),
      'passport_number' => new sfValidatorString(array('max_length' => 255)),
      'place_issued'    => new sfValidatorString(array('max_length' => 255)),
      'date_issued'     => new sfValidatorDate(),
      'date_valid'      => new sfValidatorDate(),
      'date_renewal'    => new sfValidatorDate(),
      'renewal'         => new sfValidatorBoolean(array('required' => false)),
      'person_id'       => new sfValidatorDoctrineChoice(array('model' => 'Person')),
      'created_at'      => new sfValidatorDateTime(array('required' => false)),
      'updated_at'      => new sfValidatorDateTime(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('passport[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Passport';
  }

}
